package com.mall;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.mall.util.DateUtil;

public class Discount extends AbstractDiscount{

	private double rebate =1.0 ;

	private Set<GoodsCategory> category  = new HashSet<GoodsCategory>();
	public Discount(String beginStr,String endStr,double rebate,String categoryStr ) {
		if(categoryStr!=null){
			for(String c:categoryStr.split(",")){
				category.add(GoodsCategory.get(c));
			}
		}
		this.begin = DateUtil.formatStrToDate(beginStr, DateUtil.DATE_FORMAT_SHORT);
		this.end = DateUtil.formatStrToDate(endStr, DateUtil.DATE_FORMAT_SHORT);
		this.rebate = rebate;
	}
	public double getRebate() {
		return rebate;
	}
	public void setRebate(double rebate) {
		this.rebate = rebate;
	}
	public Set<GoodsCategory> getCategory() {
		return category;
	}
	public void setCategory(Set<GoodsCategory> category) {
		this.category = category;
	}
	
}
